package com.nami.store.biz.conver.application;

import com.nami.store.api.request.conversation.ConverAddReq;
import com.nami.store.api.request.conversation.ConverC2CUpdRequest;
import com.nami.store.api.request.conversation.ConverItem;
import com.nami.store.api.request.conversation.ConverPageReq;
import com.nami.store.api.response.conversation.ConversationDTO;
import com.nami.store.api.response.conversation.ConverDetailVO;
import com.nami.store.domain.ConversationDO;
import org.dromara.common.mybatis.core.page.TableDataInfo;

import java.util.List;

public interface ConverAppService {


    List<ConversationDTO> getConversFromCacheOrDb(String appKey, List<String> userIds, String targetId);

    /**
     * @param appKey
     * @param userId
     * @param targetId
     * @return
     */
    ConversationDTO getConverFromCacheOrDB(String appKey, String userId, String targetId);

    /**
     * @param requests
     * @return
     */
    boolean batchSave(List<ConverAddReq> requests);

    boolean insertOrUpd(ConverItem conver);

    boolean updateGrpConvers(ConversationDO conversationDO);

    /**
     * 大批量会慢。小批量可以
     *
     * @param itemList
     * @return
     */
    boolean batchUpdConvers(List<ConverItem> itemList);


    boolean updPrivateChatConver(ConverC2CUpdRequest request);

    TableDataInfo<ConverDetailVO> getConvers(ConverPageReq request);

    ConverItem getConverFromCache(String appKey, String userId, String targetId);
}
